const express = require('express');
const router = express.Router();
const paging = require('../../commonPaging/paging')

router.post('/',async (req,res) => {
    let {
        sheepId,   //羊只编号
        userName,  //牧户姓名
        variety,   //品种
        birthDateLeft,  //出生日期区间左极限
        birthDateRight,  //出生日期区间右极限
        bWeightLeft,     //初生重区间左极限
        bWeightRight,   //初生重区间右极限
        wWeightLeft,   //断奶重区间左极限
        wWeightRight   //断奶重区间右极限
    } = req.body
    let arr = [
        sheepId,   //羊只编号
        userName,  //牧户姓名
        variety,   //品种
        birthDateLeft,  //出生日期区间左极限
        birthDateRight,  //出生日期区间右极限
        bWeightLeft,     //初生重区间左极限
        bWeightRight,   //初生重区间右极限
        wWeightLeft,   //断奶重区间左极限
        wWeightRight   //断奶重区间右极限
    ]
    try{
        await paging(req,res,arr,'baseInfo')
    }catch (e) {
        console.log(e);
        return res.send({
            code: 4,
            msg: '服务器错误，请稍后再试'
        })
    }

})

module.exports = router
